﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Acoris.Markdown
{
#if NET_UWP

    using Windows.Storage;

#elif NET_WPF

    using System.IO;

#endif

    /// <summary>
    /// 表示一个XML读取器
    /// </summary>
    public class XMLReader : TextReader
    {
        async public override Task<object> LoadAsync(string fileName)
        {
#if NET_UWP
            var storageFile = await StorageFile.GetFileFromPathAsync(fileName);
            var document = await FileIO.ReadTextAsync(storageFile);
            return Load(document);
#elif NET_WPF
            var stream = new StreamReader(new FileStream(fileName, FileMode.Open));
            var document = await stream.ReadToEndAsync();
            return Load(document);
#endif
        }

        internal object Load(string document)
        {
            return null;
        }
    }
}
